import 'package:flutter/material.dart';

import 'MyAppBar.dart';

/**
 * 横向listview
 * */
class horieadListView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: CommonBar(title: '横向listview'),
      body: Center(
        child: Container(
          height: 200.0,
          child: new ListView(
            scrollDirection: Axis.horizontal,
            children: [
              new Container(
                width: 180.0,
                color: Colors.blueGrey,
              ),
              new Container(
                width: 180.0,
                color: Colors.blue,
              ),
              new Container(
                width: 180.0,
                color: Colors.green,
              ),
              new Container(
                width: 180.0,
                color: Colors.purple,
              )
            ],
          ),
        ),
      ),
    );
  }
}

//绑定数据
class bindDataListView extends StatelessWidget {
  final List<String> itemss;

  bindDataListView({Key key,  this.itemss}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return  Scaffold(
        appBar: CommonBar(title: 'listview绑定数据'),
        body: new ListView.builder(
          itemCount: itemss.length,
          itemBuilder: (context, index) {
            return new ListTile(
              title: new Text('${itemss[index]}'),
            );
          },
        ),
      );

  }
}
